package com.ruoyi.logCen.kafka;

import com.alibaba.fastjson.JSONObject;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

@Service
public class KafkaConsumer {

    @KafkaListener(topics = "log_center_topic_kafka1", groupId = "log_center_group_kafka")
    public void listen(String message) {
        System.out.println("Received Message: " + message);

        JSONObject jsonObject = JSONObject.parseObject(message);

        System.out.println("ip:"+jsonObject.getString("ip"));
        System.out.println("logPath:"+jsonObject.getString("logPath"));
        System.out.println("logContent:"+jsonObject.getString("logContent"));

    }
}
